import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
// 重复路由报错
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function (location) {
  return originalPush.call(this, location).catch(err => { })
};


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'/home'
    
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView,
    children: [
      
    ]
  },
  {
    path: '/category',
    name: 'category',
    component: () => import(/* webpackChunkName: "category" */ '../views/CategoryView.vue')
  },
  {
    path: '/shop',
    name: 'shop',
    component: () => import(/* webpackChunkName: "shop" */ '../views/ShopView.vue')
  },
  {
    path: '/main',
    name: 'main',
    component: () => import(/* webpackChunkName: "shop" */ '../views/MainView.vue')
  }
]

const router = new VueRouter({
  routes,
  mode: 'history',
})

export default router
